<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="../css/swiper-4.3.5.min.css">
    <link rel="stylesheet" href="../css/element.css">
    <link rel="stylesheet" href="../css/main.css">
    <link rel="stylesheet" href="../css/person_center/person_center.css">
    <title>会员中心-消息中心</title>
</head>

<body>
    <div id="app" v-cloak>
        <headers></headers>
        <!-- search -->
        <div class="search wrap">
            <logo></logo>
            <div class="header_tit fl"></div>
            <searchs></searchs>

            <car_box></car_box>

        </div>
        <div class="wrap person_center">
            <!-- nav -->
            <div class="nav_box fl">
                <div id="subapp" v-cloak>
                    <div class="person_nav fl">
                        <ul>
                            <li @click='person_order'>首页</li>
                            <li @click='person_center'>我的订单</li>
                            <li @click='person_address'>收货地址</li>
                            <li @click='person_exchange_page'>积分换货</li>
                            <li @click='person_intergal'>积分订单</li>
                            <li @click='person_collection'>我的收藏</li>
                            <li @click='person_foot'>浏览足迹</li>
                            <li @click='person_ticket'>优惠券</li>
                            <li @click='person_info'>个人设置</li>
                            <li class="active">消息中心</li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="right_box fl">
                <div class="message_box">
                    <div class="message_nav">
                        <ul>
                            <!-- <li :class="{active:index_active == index}" v-for='(item,index) in tabsParam' @click='tabs(index)'>{{item}}{{message_num}}</li> -->
                            <!-- <li :class="{active:index_active == 0}"  @click='tabs(0)'>聊天</li> -->
                            <li :class="{active:index_active == 1}"  @click='tabs(1)'>商家信息({{message_num}})</li>
                        </ul>
                    </div>

                    <div class="message_list" v-show='index_active==0'>
                        <div class="message_item" v-for="(item,index) in address">
                            <div class="message_img fl">

                            </div>
                            <p class="message_tit fl">您有一张50元的优惠券即将过期</p>
                            <p class="message_data fr">2018-10-07 16:06</p>
                        </div>
                    </div>
                    <div class="message_list" v-show='index_active==1'>
                        <div class="message_item cursor" :class="{ item_color : item.status==1 }" @click='message_detai(index,item.id)' v-for="(item,index) in list">
                            <div class="person_title fl">
                                【{{item.title}}】
                            </div>
                            <p class="message_tit message_nomargintop fl" :class="{two_row:index_row != index}">{{item.msg}}</p>
                            <p class="message_data message_nomargintop fr">{{item.createTime}}</p>
                        </div>
                    </div>
                </div>
            </div>


        </div>





       <div class="wrap clear_both">             <productfooter></productfooter>         </div>
    </div>
     
    <script src="../js/axios.js"></script>         <script src="../js/qs.js"></script>
    <script src="../js/swiper-4.3.5.min.js"></script>
    <script src="../js/browser.min.js"></script>
    <script src="../js/vue.js"></script>
    <script src="../js/element.js"></script>
    <script src="../js/main.js"></script>
    <script type="text/babel">
        var app = new Vue({
            el: '#app',
            data() {
                return {
                    address:4,
                    input10:'',
                    input11:'',
                    add_popup:false,
                    car_active:false,groups:3,
                    radio:'',
                    list:'',
                    tabsParam:['聊天','商家信息'],
                    index_active:1,
                    index_row:'',
                    message_num:''
                };
            },
            created() {
                
            },
            mounted() {
                this.listSysMessageDetailMemberUser('')
                this.countUnReadMsgNum()
            },
            methods: {
                // 未读消息
                
                countUnReadMsgNum(){
                    axios({
                        method:"POST",
                        url:base_url + "/sysMessage/countUnReadMsgNum",
                        data:Qs.stringify({
                            status:0
                        }),
                        headers:{
                            'Content-Type':'application/x-www-form-urlencoded',
                            "TOKEN":localStorage.getItem('wACCESS_TOKEN')
                        }
                    })
                    .then(function (res) {
                        console.log(res.data.data)
                        app.message_num = res.data.data.object
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                },
                message_detai(index,id){
                    app.updateSMDStatus(id)
                    app.listSysMessageDetailMemberUser(index)
                },
                updateSMDStatus(id){
                    axios({
                        method:"POST",
                        url:base_url + "/sysMessage/updateSMDStatus",
                        data:Qs.stringify({
                            id:id,
                            type:0
                        }),
                        headers:{
                            'Content-Type':'application/x-www-form-urlencoded',
                            "TOKEN":localStorage.getItem('wACCESS_TOKEN')
                        }
                    })
                    .then(function (res) {
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                },
                tabs(index){
                    app.index_active = index
                },
                listSysMessageDetailMemberUser(index){
                    axios({
                        method:"POST",
                        url:base_url + "/sysMessage/listSysMessageDetailMemberUser",
                        data:Qs.stringify({
                        }),
                        headers:{
                            'Content-Type':'application/x-www-form-urlencoded',
                            "TOKEN":localStorage.getItem('wACCESS_TOKEN')
                        }
                    })
                    .then(function (res) {
                        app.list = res.data.data.list.list
                        app.index_row = index
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                },
                // 显示购物车               
                go_shop_car(){                     
                    window.location.href='../product/shop_car.html'  
                },
                car_box(){
                    this.car_active = !this.car_active
                },
                person_order(){
                    window.location.href='person_order.html'
                },
                person_address(){
                    window.location.href='person_address.html'
                },
                person_exchange_page(){
                    window.location.href='person_exchange_page.html'
                },
                person_center(){
                    window.location.href='person_center.html?index='+0
                },
                person_intergal(){
                    window.location.href='person_integral_order.html'
                },
                person_collection(){
                    window.location.href='person_collection.html'
                },
                person_ticket(){
                    window.location.href='person_ticket.html'
                },
                person_info(){
                    window.location.href='person_info.html'
                },
                person_foot(){
                    window.location.href='person_footprint.html'
                }
            }
        })
        
    </script>
</body>

</html>